Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add validation for types that are not installed #1145

Merged
merged 10 commits into from
Jul 3, 2024
Merged

Conversation

dirkkul
Copy link
Collaborator

@dirkkul dirkkul commented Jul 2, 2024

We accept numpy etc as vectors and convert them internally into lists. This causes problems with the new multi-vector approach, as we need to do different things depending on the input type.

This adds:

  • input-validation for numpy etc without installing these dependencies
  • better type checking in near_vector code

@dirkkul dirkkul requested a review from a team as a code owner July 2, 2024 12:21
@codecov-commenter
Copy link

codecov-commenter commented Jul 2, 2024

Codecov Report

Attention: Patch coverage is 90.90909% with 13 lines in your changes missing coverage. Please review.

Please upload report for BASE (dev/1.26@18d94fc). Learn more about missing BASE report.

Files Patch % Lines
weaviate/collections/grpc/query.py 66.66% 4 Missing ⚠️
weaviate/str_enum.py 60.00% 4 Missing ⚠️
weaviate/util.py 75.00% 4 Missing ⚠️
integration/test_collection_near_vector.py 98.68% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             dev/1.26    #1145   +/-   ##
===========================================
  Coverage            ?   94.52%           
===========================================
  Files               ?      197           
  Lines               ?    19429           
  Branches            ?        0           
===========================================
  Hits                ?    18365           
  Misses              ?     1064           
  Partials            ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tsmith023
Copy link
Contributor

Can we also improve the types of the method in query.pyi within this PR? Currently we just have List[float] when we in fact allow these other types. I wonder how to achieve that without importing those types as actual dependencies 🤔

@dirkkul
Copy link
Collaborator Author

dirkkul commented Jul 3, 2024

Can we also improve the types of the method in query.pyi within this PR? Currently we just have List[float] when we in fact allow these other types. I wonder how to achieve that without importing those types as actual dependencies 🤔

I don't think this is possible, but I'd like to get this merged as it is currently a regression

test/collection/test_validator.py Show resolved Hide resolved
weaviate/str_enum.py Show resolved Hide resolved
weaviate/validator.py Show resolved Hide resolved
@dirkkul dirkkul merged commit e59bf43 into dev/1.26 Jul 3, 2024
45 checks passed
@dirkkul dirkkul deleted the better_type_checking branch July 3, 2024 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants